﻿using GenericSide;
using GM_Shop.Model;
using GM_Shop.Model.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GM_Shop.DAL
{
    public class InsertData
    {
        public CJson InsertShoppingCart(int[] arr,int uid)
        {
            var a = 0;
            foreach (var item in arr)
                a += SqlHelper.Insert<CShoppingCart>(new CShoppingCart() { 
                    UId = uid,
                    CommodityInfoId = item,
                    AddTime = DateTime.Now,
                    AddCount = 1
                });
            if (a != 0)
                return new CJson(1, "加入购物车成功");
            else
                return new CJson(0, "家务购物车失败");
        }

        public int InsertUserReceiptPath(string[] info,int Uid) {
            var itemUserName = SqlHelper.Insert<CUserReceiptPath>(new CUserReceiptPath() { 
                UId = Uid,UserName = info[0],Phone = info[1],ReceiptPath = info[2]
            });
            return itemUserName;
        }

    }
}
